mem = {}


def cnt(m, n):
    if m == 1 or n == 1:
        return 1
    if (m, n) not in mem:
        mem[(m, n)] = cnt(m, n - 1) + cnt(m - 1, n)
    return mem[(m, n)]


print(cnt(7, 3))
